﻿@model Dictionary<string, object>
@{
    ViewBag.Title = "瀚华通 - 企业/个体工商户及个人在线贷款";
    ViewBag.Keywords = "瀚华通,瀚华信贷,瀚华小额贷款,瀚华小贷,瀚华,在线信贷服务";
    ViewBag.Description = "瀚华通是瀚华信贷旗下的网络信贷服务平台，一方面为服务老客户提供“贷款信息自助查询”功能，一方面为开拓新用户，特别是为网络用户提供“贷款申请”功能，网站面向中小企业、个体工商户和个人三类小额贷款服务对象，为网络贷款用户提供“15分钟快速响应”的品牌信贷服务，承诺客户15分钟内快速应答，珍惜客户时间，提升瀚华信贷服务速度与品质。";
}
@section header{
    <link media="screen" href="/ligerUI/skins/aqua/css/ligerui-form.css" type="text/css"
        rel="stylesheet" />
    <link media="screen" href="/bootstrap/css/bootstrap-responsive.css" type="text/css"
        rel="stylesheet" />
    <style type="text/css">
        .mask
        {
            position: absolute;
            top: 0px;
            filter: alpha(opacity=80);
            background-color: #333;
            z-index: 1002;
            left: 0px;
            opacity: 0.5;
            -moz-opacity: 0.5;
        }
        .model
        {
            position: absolute;
            z-index: 1003;
            text-align: center;
            display: none;
        }
        #frmQuery .errorPlace
        {
            height:25px;
            }
        #frmQuery label.error
        {
            color:#C5000A;
            border: 0px solid #FFC340;
            font-size: 12px;
            left: 119px;
            margin: 0;
            padding: 4px 8px;
            position: relative;
            top: 0px;
            width: 205px;
            z-index: 10000;
            }
    </style>
    <script type="text/javascript" src="/Scripts/jquery.form.js"></script>
    <script type="text/javascript" src="/Scripts/jquery.validate.min.js"></script>
    <script src="/Scripts/jquery.validate.message.cn.js" type="text/javascript"></script>
    <script type="text/javascript" src="/bootstrap/js/bootstrap-tab.js"></script>
    <script type="text/javascript" src="/bootstrap/js/bootstrap-validation.js"></script>
    <script type="text/javascript" src="/bootstrap/js/bootstrap-modal.js"></script>
    <script type="text/javascript" src="/Scripts/base.js"></script>
    <script type="text/javascript" src="/Scripts/ligerTip.js"></script>
    <script type="text/javascript">
        nereidFadeObjects = new Object();
        nereidFadeTimers = new Object();
        function nereidFade(object, destOp, rate, delta) {
            if (!document.all)
                return
            if (object != "[object]") {  //do this so I can take a string too
                setTimeout("nereidFade(" + object + "," + destOp + "," + rate + "," + delta + ")", 0);
                return;
            }
            clearTimeout(nereidFadeTimers[object.sourceIndex]);
            diff = destOp - object.filters.alpha.opacity;
            direction = 1;
            if (object.filters.alpha.opacity > destOp) {
                direction = -1;
            }
            delta = Math.min(direction * diff, delta);
            object.filters.alpha.opacity += direction * delta;
            if (object.filters.alpha.opacity != destOp) {
                nereidFadeObjects[object.sourceIndex] = object;
                nereidFadeTimers[object.sourceIndex] = setTimeout("nereidFade(nereidFadeObjects[" + object.sourceIndex + "]," + destOp + "," + rate + "," + delta + ")", rate);
            }
        }
        

        jQuery.validator.addMethod("isChinese", function (value, element) {
            var reg_cn = /^[\u0391-\uFFE5]+$/;
            return this.optional(element) || (reg_cn.test(value));
        }, "只能输入中文");
        //手机号码验证      
        jQuery.validator.addMethod("isMobile", function (value, element) {
            var length = value.length;
            var mobile = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
            return this.optional(element) || (length == 11 && mobile.test(value));
        }, "手机号格式有误");
        //固话和手机都可验证
        jQuery.validator.addMethod("isPhone", function(value,element) { 
          var length = value.length; 
          var mobile = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;          
          var tel = /^\d{3,4}-?\d{7,9}$/;
          return this.optional(element) || (tel.test(value) || mobile.test(value));  
        }, "备用电话格式有误"); 

        function ajaxSubmit() {
            $.post("/home/ordersave", $("#frmMain").serialize(), function (data) {

                if (data == 1) {
                    showTip("#dvSuccess");
                }
                else { alert("申请失败"); }
            })
        }

        $(function () {
            AjaxOnSubmit('frmMain', 'btnSubmit', '/home/ordersave');
            QueryAjaxOnSubmit('frmQuery', 'btnSearch', '/query/validate');
            //SendVCodeAjaxOnSubmit('frmQuery', 'btnSend', '/Interface/SengSmsVCode');
            $("a[data-toggle=tab]").click(function () { $(".l-verify-tip").hide(); })

        });

        /*表单AJAX提交封装*/
        function AjaxOnSubmit(form_id, btn_id, send_url) {
            $('#' + form_id).validate({
                errorPlacement: function (lable, element) {
                    lable.ligerHideTip();
                    element.ligerTip({ content: lable.html(), appendIdTo: lable });
                },
                success: function (lable) {
                    lable.ligerHideTip();
                },
                submitHandler: function (form) {
                    //AJAX提交表单
                    $(form).ajaxSubmit({
                        beforeSubmit: formRequest,
                        success: formResponse,
                        error: formError,
                        url: send_url,           //处理ajax请求的地址
                        type: "post",
                        dataType: "json",
                        resetForm: true,
                        timeout: 30000
                    });
                    return false;
                }
            });

            //表单提交前
            function formRequest(formData, jqForm, options) {
                $("#" + btn_id).attr("disabled", "disabled");
                $("#" + btn_id).val("提交中...");
            }

            //表单提交后
            function formResponse(data, textStatus) {
                if (data == 1) {
                    $("#modal-success").modal({ backdrop: true,
                        keyboard: true,
                        show: true
                    });
                    //                    showTip();       
                } else if (data == 2) { //提交订单出错
                    $("#" + btn_id).attr("disabled", "");
                    $("#" + btn_id).val("再次提交");
                }
                else if (data == 3) { //查询正确
                    location.href = "/query/list";
                }
                else if (data == 4) { //查询出错
                    $("#modal-false").modal({ backdrop: true,
                        keyboard: true,
                        show: true
                    });
                }
                else if (data == 5) { //查询出错
                    $("#modal-timeout").modal({ backdrop: true,
                        keyboard: true,
                        show: true
                    });
                }
                else if (data == 9) { //黑名单
                    alert("您输入的手机号已进入黑名单，请不要恶意申请。")
                }
                $("#" + btn_id).val("确认提交");
                $("#" + btn_id).removeAttr("disabled");
            }

            //表单提交出错
            function formError(XMLHttpRequest, textStatus, errorThrown) {
                $("#" + btn_id).attr("disabled", "");
                $("#" + btn_id).val("再次提交");
            }
        }


        /*表单AJAX提交封装*/
        function QueryAjaxOnSubmit(form_id, btn_id, send_url) {
            $('#' + form_id).validate({
                errorPlacement: function (error, element) {
                    //error.appendTo(element.parent().parent());
                    error.appendTo(element.parent().siblings("div"));
                    //$("#btnSend").attr("disabled", "disabled");
                },
                rules: {
                    "txtIdCard": {
                        required: true,
                        isIdCardNo: true,
                        IdCardExist: true
                    },
                    "txtPhone": {
                        required: true,
                        isMobile: true,
                        PhoneExist: true
                    },
                    "txtVCode": {
                        required: true
                    }
                },
                messages: {
                    "txtIdCard": {
                        required: "请输入身份证号",
                        isIdCardNo: "身份证号格式错误",
                        IdCardExist: "不存在此身份证号的贷款记录"
                    },
                    "txtPhone": {
                        required: "请输入手机号",
                        isMobile: "手机号格式错误",
                        PhoneExist: "系统不存在此手机号的贷款记录"
                    },
                    "txtVCode": {
                        required: "请输入验证码"
                    }
                },
                success: function (lable) {
                    lable.ligerHideTip();
                    //$("#btnSend").removeAttr("disabled");
                },
                submitHandler: function (form) {
                    //AJAX提交表单
                    $(form).ajaxSubmit({
                        beforeSubmit: formRequest,
                        success: formResponse,
                        error: formError,
                        url: send_url,           //处理ajax请求的地址
                        type: "post",
                        dataType: "json",
                        resetForm: true,
                        timeout: 30000
                    });
                    return false;
                }
            });


            //表单提交前
            function formRequest(formData, jqForm, options) {
                $("#" + btn_id).attr("disabled", "disabled");
                $("#" + btn_id).val("提交中...");
            }

            //表单提交后
            function formResponse(data, textStatus) {
                if (data == 1) {
                    $("#modal-success").modal({ backdrop: true,
                        keyboard: true,
                        show: true
                    });
                    //                    showTip();       
                } else if (data == 2) { //提交订单出错
                    $("#" + btn_id).attr("disabled", "");
                    $("#" + btn_id).val("再次提交");
                }
                else if (data == 3) { //查询正确
                    location.href = "/query/list";
                }
                else if (data == 4) { //查询出错
                    $("#modal-false").modal({ backdrop: true,
                        keyboard: true,
                        show: true
                    });
                }
                else if (data == 5) { //查询出错
                    $("#modal-timeout").modal({ backdrop: true,
                        keyboard: true,
                        show: true
                    });
                }
                $("#" + btn_id).val("确认提交");
                $("#" + btn_id).removeAttr("disabled");
            }

            //表单提交出错
            function formError(XMLHttpRequest, textStatus, errorThrown) {
                $("#" + btn_id).attr("disabled", "");
                $("#" + btn_id).val("再次提交");
            }
        }
        function showInfo(id, divId) {
            //alert($(advImg_3_2).attr("src"));
                        $("[num]").each(function () {
                            $(this).fadeTo("fast", 0.7, function () { });
                        });
            $(divId).fadeTo("fast", 1, function () { });
            $(".largeImg").hide();
            $(id).show();
        }

        function FadeAdjust(ctrl) {
//          $(ctrl).fadeTo("fast", 0.5, function () { });
//            var find = false;
//            $("[num]").each(function () {
//                if ($(this).attr("opacity") == 1) {
//                    find = true;
//                }
//            });
//            if (!find) {
//                $("#advImg_1_1").fadeTo("fast", 1, function () { });
//            }
        }

        function showMask() {
            $("#mask").css("height", $(document).height());
            $("#mask").css("width", $(document).width());
            $("#mask").show();
        }

        //让指定的DIV始终显示在屏幕正中间  
        function showTip(divName) {
            showMask();
            var top = ($(window).height() - $(divName).height()) / 2;
            var left = ($(window).width() - $(divName).width()) / 2;
            var scrollTop = $(document).scrollTop();
            var scrollLeft = $(document).scrollLeft();
            $(divName).css({ position: 'absolute', 'top': top + scrollTop, left: left + scrollLeft }).show();
        }
        $(function () {
            $("#modaltest").click(function () {
                $("#modal-success").modal(
                    {
                        backdrop: true,
                        keyboard: true,
                        show: true
                    });
            });
            $("#btnSubmit").click(function () {
                if ($("#chkAgree2").attr("checked") != "checked") {
                    alert("请选择同意遵守用户协议");
                    return false;
                }
            });
            $("#btnSearch").click(function () {
                if ($("#chkAgree").attr("checked") != "checked") {
                    alert("请选择同意遵守用户协议");
                    return false;
                }
            });
        })

    </script>
    }
    @{
    string imgDomain = System.Configuration.ConfigurationManager.AppSettings["AdminURL"] != null
                ? System.Configuration.ConfigurationManager.AppSettings["AdminURL"].ToString() : "http://tong.hanhua.com:81/";
    }
    <div class="container main">
        <div class="row" >
            <!--主体左半边-->
            <div class="span7" style="width:540px;overflow:hidden;float:left;">
                <div class="row">
                    <div class="advImg leftImg" id="advImg_1_1" style="opacity: 1; filter:alpha(opacity=100); margin-top: 4px;" 
                    onmouseover="showInfo(info_1_1, advImg_1_1)" onmouseout='FadeAdjust(this)' num="1" >
                        <a>
                            <img src="/images/adv/01.gif" width="372" height="134" alt="微金融" 
                            style="-moz-opacity:1;opacity:1; filter:alpha(opacity=100);"
                        /></a>
                    </div>
                    <div class="advImg smallImg" id="advImg_1_2" num="2" style=" margin-top: 4px;" 
                    onmouseover="showInfo(info_1_2, advImg_1_2)" onmouseout='FadeAdjust(this)'>
                        <a>
                            <img src="/images/adv/02.jpg" width="146" height="134" alt="瀚华信贷" 
                         /></a>
                    </div>
                </div>
                <div class="row">
                    <div class="advImg leftImg smallImg" id="advImg_2_1" num="3" 
                    onmouseover="showInfo(info_2_1, advImg_2_1)" onmouseout='FadeAdjust(this)'>
                        <a><img src="/images/adv/03.jpg" width="146" height="134" alt="瀚华通" 
                         /></a>
                    </div>
                    <div class="advImg" style="margin-left: 1px;" id="advImg_2_2" num="4"
                     onmouseover="showInfo(info_2_2, advImg_2_2)" onmouseout='FadeAdjust(this)'>
                        <a><img src="/images/adv/04.jpg" width="372" height="134" alt="瀚华小贷"
                         /></a>
                    </div>
                </div>
                <div class="row">
                    <div class="advImg leftImg" id="advImg_3_1" num="5"
                    onmouseover="showInfo(info_3_1, advImg_3_1)" onmouseout='FadeAdjust(this)'>
                        <a><img src="/images/adv/05.jpg" width="372" height="134" alt="瀚华贷款" 
                         /></a>
                    </div>
                    <div class="advImg smallImg" id="advImg_3_2" num="6" 
                    onmouseover="showInfo(info_3_2, advImg_3_2)" onmouseout='FadeAdjust(this)'>
                        <a><img src="/images/adv/06.jpg" width="146" height="134" alt="瀚华信贷" /></a>
                    </div>
                </div>
                <div class="row">
                    <div id="info_1_1" class="advImg largeImg">
                        @(Html.Raw(Model["info1"].ToString()))
                    </div>
                    <div id="info_1_2" class="advImg largeImg" style="display: none;">
                        @(Html.Raw(Model["info2"].ToString()))
                    </div>
                    <div id="info_2_1" class="advImg largeImg" style="display: none;">
                        @(Html.Raw(Model["info3"].ToString()))
                    </div>
                    <div id="info_2_2" class="advImg largeImg" style="display: none;">
                        @(Html.Raw(Model["info4"].ToString()))
                    </div>
                    <div id="info_3_1" class="advImg largeImg" style="display: none;">
                        @(Html.Raw(Model["info5"].ToString()))
                    </div>
                    <div id="info_3_2" class="advImg largeImg" style="display: none;">
                        @(Html.Raw(Model["info6"].ToString()))
                    </div>
                </div>
            </div>
            <!--主体右半边-->
            <div class="span5" style="float:right;width:411px;overflow:hidden;">
                <div class="row">
                    <div class="margin3">
                        <img src="/images/flow.jpg" alt="瀚华通贷款申请流程" />
                    </div>
                </div>
                <div class="row">
                    <div style="margin-bottom: 5px;" class="tabbable">
                        <ul class="nav nav-tabs" id="normaltab" style="margin-top: 18px;">
                            <li class="active"><a data-toggle="tab" href="#tab_apply">
                                <h4 style="color: #000; font-size: 15px">
                                    自助申请</h4>
                            </a></li>
                            <li class=""><a data-toggle="tab" href="#tab_query">
                                <h4 style="color: #000; font-size: 15px">
                                    自助查询</h4>
                            </a></li>
                        </ul>
                        <div class="clear"></div>
                        <div class="tab-content" id="normalcon" style="height: 481px">
                            <div id="tab_apply" class="tab-pane active">
                                @Html.Partial("~/Views/Shared/Home/OrderForm.cshtml")
                            </div>
                            <div id="tab_query" class="tab-pane">
                                @Html.Partial("~/Views/Shared/Home/tab_query.cshtml")
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="mask" class="mask">
    </div>
    <div class="modal hide fade in" id="modal-success">
        <div class="modal-header">
            <a data-dismiss="modal" class="close" href="#">×</a>
            <h3>
                <img src="/images/success.png" />&nbsp; 预约成功</h3>
        </div>
        <div class="modal-body" style="text-align: center;">
            <p>
            </p>
            <p style="font-size: 16px;">
                感谢您对瀚华信贷的支持，我们的客服经理将在15分钟内与您联系。
                </p>
            <p style="font-size: 14px;">
                （非工作时间申请，我们将于下一个工作日给您回复）</p>
        </div>
    </div>
    <div class="modal hide fade in" id="modal-false">
        <div class="modal-header">
            <a data-dismiss="modal" class="close" href="#">×</a>
            <h3>
                <img src="/images/error.png" />&nbsp; 出错啦！</h3>
        </div>
        <div class="modal-body" style="text-align: center;">
            <p>
            </p>
            <p style="font-size: 16px;">
                十分抱歉，您的验证码输入错误，请重新获取验证码，谢谢。</p>
            <p style="font-size: 16px;">
                详情咨询：<span style="color: #C5000A">023-89666689</span></p>
        </div>
    </div>
    <div class="modal hide fade in" id="modal-timeout">
        <div class="modal-header">
            <a data-dismiss="modal" class="close" href="#">×</a>
            <h3>
                <img src="/images/error.png" />&nbsp; 出错啦！</h3>
        </div>
        <div class="modal-body" style="text-align: center;">
            <p>
            </p>
            <p style="font-size: 16px;">
                十分抱歉，您的验证码已过期，请重新获取验证码，谢谢。</p>
            <p style="font-size: 16px;">
                详情咨询：<span style="color: #C5000A">023-89666689</span></p>
        </div>
    </div>
    @Html.Partial("~/Views/Shared/Home/procotol.cshtml")


@section footer{
    <script type="text/javascript">
        $(function () {
            loadProvinces();
            loadProvinces1();
        });
        function loadProvinces() {
            var ddl1 = $('#t0_address_province');
            ddl1.empty();
            ddl1.append('<option value="" selected="selected">-省份-</option>');
            $.getJSON('/Interface/province', null, function (data) {
                $.each(data, function (i, item) {
                    ddl1.append('<option value="' + item.id + '">' + item.name + '</option>');
                });
                ddl1.change(loadCities);
                p = ddl1.attr('title');
                if (p != '') {
                    ddl1.val(p);
                    loadCities();
                }
            });
        }
        function loadCities() {
            var p = $('#t0_address_province').val();
            //alert(p);
            var ddl2 = $('#t0_address_city');
            ddl2.empty();
            ddl2.append('<option value="" selected="selected">-城市-</option>');
            if (p == '') {
                return;
            }
            $.getJSON('/Interface/city', { id: p }, function (data) {
                $.each(data, function (i, item) {
                    ddl2.append('<option value="' + item.id + '">' + item.name + '</option>'); //alert("city_each");
                });
                ddl2.unbind("change");
                ddl2.change(loadDistricts);
                c = ddl2.attr('title');
                if (c != '') {
                    ddl2.val(c);
                    loadDistricts();
                }
            });
        }
        function loadDistricts() {
            var p = $('#t0_address_city').val();
            //alert('cityid=' + p);
            var ddl3 = $('#t0_address_district');
            ddl3.empty();
            ddl3.append('<option value="" selected="selected">-区域-</option>');
            if (p == '') {
                return;
            }
            $.getJSON('/Interface/districts', { id: p }, function (data) {
                //ddl3.empty();
                $.each(data, function (i, item) {
                    ddl3.append('<option value="' + item.id + '">' + item.name + '</option>');
                });
//                c = ddl.attr('title');
//                if (c != '') {
//                    ddl.val(c);
//                }
            });
        }

        function loadProvinces1() {
            var ddl = $('#t1_address_province');
            ddl.empty();
            ddl.append('<option value="" selected="selected">-省份-</option>');
            $.getJSON('/Interface/province', null, function (data) {
                $.each(data, function (i, item) {
                    ddl.append('<option value="' + item.id + '">' + item.name + '</option>');
                });
                ddl.change(loadCities1);
                p = ddl.attr('title');
                if (p != '') {
                    ddl.val(p);
                    loadCities1();
                }
            });
        }
        function loadCities1() {
            var p = $('#t1_address_province').val();
            //alert(p);
            var ddl = $('#t1_address_city');
            ddl.empty();
            ddl.append('<option value="" selected="selected">-城市-</option>');
            if (p == '') {
                return;
            }
            $.getJSON('/Interface/city', { id: p }, function (data) {
                $.each(data, function (i, item) {
                    ddl.append('<option value="' + item.id + '">' + item.name + '</option>');
                });
                ddl.unbind("change");
                ddl.change(loadDistricts1);
                c = ddl.attr('title');
                if (c != '') {
                    ddl.val(c);
                    loadDistricts1();
                }
            });
        }
        function loadDistricts1() {
            var p = $('#t1_address_city').val();
            //alert('cityid=' + p);
            var ddl = $('#t1_address_district');
            ddl.empty();
            ddl.append('<option value="" selected="selected">-区域-</option>');
            if (p == '') {
                return;
            }
            $.getJSON('/Interface/districts', { id: p }, function (data) {
                ddl.empty();
                $.each(data, function (i, item) {
                    ddl.append('<option value="' + item.id + '">' + item.name + '</option>');
                });
                c = ddl.attr('title');
                if (c != '') {
                    ddl.val(c);
                }
            });
        }

        /*+++++++++++++++++++++++++++++++++++++++显示用户协议+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
        function showProtocol() {
            $("#regProtocol").css("display", "block");
        }
        function closeWindow() {
            $("#regProtocol").css("display", "none");
        }
        /*
        $(function () {
            $("#chkAgree").click(function () {
                if ($(this).attr("checked") == "checked") {
                    $("#btnSearch").removeAttr("disabled");
                }
                else {
                    $("#btnSearch").attr("disabled", "disabled");
                }
            });
            $("#chkAgree2").click(function () {
                if ($(this).attr("checked") == "checked") {
                    $("#btnSubmit").removeAttr("disabled");
                }
                else {
                    $("#btnSubmit").attr("disabled", "disabled");
                }
            });
        });
            */
        /*+++++++++++++++++++++++++++++++++++++++显示用户协议完+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/	
        function showErrors() {
            //alert("showError in..");
            var t = this;
            for (var i = 0; this.errorList[i]; i++) {
                var error = this.errorList[i];
                this.settings.highlight && this.settings.highlight.call(this, error.element, this.settings.errorClass, this.settings.validClass);

                var elename = this.idOrName(error.element);
                // 错误信息div   
                var errdiv = $('div[htmlfor=' + elename + ']');
                var errimg = $('img[htmlfor=' + elename + ']');
                if (errdiv.length == 0) { // 没有div则创建   

                    //纯css不用图片的圆角div，存在在IE6下显示过长的问题   
                    //                    errdiv = $('<div>'
                    //                                  + '<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>'
                    //                                  + '<span class="errmsg"> </span>'
                    //                                  + '<b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b> '
                    //                                  + '</div> ');

                    // 带图片的圆角div在所有浏览器兼容   
                    errdiv = $('<div>'
                            + '<img src="/images/left_icon.gif" width="6" height="24" align="absmiddle" class="fl" />'
                            + '<div class="errmsgdiv fl errmsg"></div>'
                            + '<img src="/images/right_icon.gif" width="6" height="24" align="absmiddle" class="fl" />'
                            + '</div>');


                    errdiv.attr({ "for": this.idOrName(error.element), generated: true })
                    .addClass(this.settings.errorClass);
                    errdiv.css({ left: $.getLeft(error.element) + 'px', top: $.getTop(error.element) + 'px' }); // 显示在控件的下面   
                    errdiv.appendTo($('body'));
                }
                //alert("errimg.length =" + errimg.length)
                if (errimg.length == 0) { // 没有img则创建   
                    errimg = $('<img alt="错误" src="/images/unchecked.gif">')
                    errimg.attr({ "htmlfor": this.idOrName(error.element), generated: true });
                    errimg.insertAfter(error.element);
                }
                errimg.show();
                errdiv.find(".errmsg").html(error.message || "");
                // 鼠标放到图片显示错误
                $(errimg).hover(function (e) {
                    $('div[htmlfor="' + $(this).attr('htmlfor') + '"]').css({ left: (e.pageX - 90) + 'px', top: (e.pageY + 15) + 'px' }); // 显示在鼠标位置偏移20的位置   
                    $('div[htmlfor="' + $(this).attr('htmlfor') + '"]').fadeIn(200);
                },
                function () {
                    $('div[htmlfor="' + $(this).attr('htmlfor') + '"]').fadeOut(200);
                });
                // 鼠标放到控件上显示错误   
                $(error.element).hover(function (e) {
                    $('div[htmlfor="' + t.idOrName(this) + '"]').css({ left: (e.pageX - 20) + 'px', top: (e.pageY + 10) + 'px' }); // 显示在鼠标位置偏移20的位置   
                    $('div[htmlfor="' + t.idOrName(this) + '"]').fadeIn(200);
                },
                function () {
                    $('div[htmlfor="' + t.idOrName(this) + '"]').fadeOut(200);
                });
            }

            // 校验成功的去掉错误提示   
            for (var i = 0; this.successList[i]; i++) {
                $('div[htmlfor="' + this.idOrName(this.successList[i]) + '"]').remove();
                $('img[htmlfor=' + this.idOrName(this.successList[i]) + ']').hide();
            }

            // 自定义高亮   
            if (this.settings.unhighlight) {
                for (var i = 0, elements = this.validElements(); elements[i]; i++) {
                    this.settings.unhighlight.call(this, elements[i], this.settings.errorClass, this.settings.validClass);
                }
            }
        }
        $.extend({
            getLeft: function (object) {
                var go = object;
                var oParent, oLeft = go.offsetLeft;
                while (go.offsetParent != null) {
                    oParent = go.offsetParent;
                    oLeft += oParent.offsetLeft;
                    go = oParent;
                }
                return oLeft;
            },
            getTop: function (object) {
                var go = object;
                var goHeight = go.height;
                var oParent, oTop = go.offsetTop;
                while (go.offsetParent != null) {
                    oParent = go.offsetParent;
                    oTop += oParent.offsetTop;
                    go = oParent;
                }
                return oTop + 22; // 之所以加22不加控件高度,为了兼容ie6.   
            }
        });   
    </script>
}
